<template>
  <div id="app">
    <router-view></router-view> 
  </div> 
</template>
<script>
  export default {
    name: "app",
    created() {
      /** 获取鉴权需要的参数 */
      // console.log(location.href)
      let url = location.href.split("#")[0]
      let corpId = url.split("corpid=")[1]
      localStorage.setItem("url", url)
      localStorage.setItem("corpId", corpId)
      /** 获取企业id 然后缓存 */
      if (localStorage.getItem("store")) {
        this.$store.replaceState(
          Object.assign({},
            this.$store.state,
            JSON.parse(localStorage.getItem("store"))
          )
        )
        /** 三秒后清除缓存 */
        setTimeout(() => {
          localStorage.removeItem("store")
        }, 3000)
      }
      //在页面刷新时将vuex里的信息保存到sessionStorage里
      window.addEventListener("beforeunload", () => {
        localStorage.setItem("store", JSON.stringify(this.$store.state))
      })
    }
  }; 
</script>

<style> 
  #app {
    font-family: "Avenir", Helvetica, Arial, sans-serif; 
    -webkit-font-smoothing: antialiased; 
    -moz-osx-font-smoothing: grayscale;
    color: #2c3e50;
    height: 100%;
    background: #f5f7f9;
  } 
</style>